#ifndef _SGE_IEDITOR_TOOL_H_
#define _SGE_IEDITOR_TOOL_H_

#include <irrlicht.h>
#include <fastsig/fastsig.hpp>
#include "Editor.h"

class IEditorTool:public fastsig::trackable
{
public:
	IEditorTool(Editor* editor)
		:editor(editor)
	{
	}
	virtual ~IEditorTool(){}
	virtual irr::core::stringc getIcon() const=0;
	virtual irr::core::stringw getToolTipText() const=0;
	virtual bool isPushButton() const = 0;
	virtual void setActive(bool state){active=state;}
	void OnEvent(const irr::SEvent& ev)
	{
		if(ev.GUIEvent.EventType==irr::gui::EGET_BUTTON_CLICKED)
			setActive(!active);
	}
protected:
	bool active;
	Editor* editor;
};

class QuitTool:public IEditorTool
{
public:
	QuitTool(Editor* editor)
		:IEditorTool(editor)
	{
	}

	virtual irr::core::stringc getIcon() const
	{
		return "editor/quit.png";
	}
	virtual irr::core::stringw getToolTipText() const
	{
		return "Quit the editor";
	}
	virtual bool isPushButton() const
	{
		return false;
	}
	virtual void setActive(bool state)
	{
		IEditorTool::setActive(state);
		editor->stop();
	}
};


#endif